|
![](/i/fill.gif) |
> Hi all.
>
> I've been staring at this for 20 minutes and I'm obviously missing
> something really obvious. Would one of you be kind enough to point out
> my mistake?
>
> I want to stand a box on one corner (so the lowest corner is at the
> origin) and rotate it about the y axis (which should pass directly
> through the upper/lower corners).
>
> box {-.5,.5
> texture{BoxTexture}
> rotate 45*z
> rotate 45*x
> translate y*pow(3,.5)/2
> rotate -y*(30+clock*360)
> }
>
> I also have a plane {y,0} with a reflective texture. The tip of the
> reflection and box come _very_ close but do not quite touch (more than
> an AA artifact).
>
> When the cube is rotated, the top/bottom corners describe small circles
> horizontally - Which leads me to conclude I haven't rotated the cube
> correctly - but 45/45 seems intuitively correct?
>
> What am I doing wrong when orientating the box?
>
> Sorry to have to ask such a simple question - I've just been staring at
> it too long
>
> Many thanks in advance
>
Start your box as:
box{0,1...}
That way, you start with a corner exactly at the origin, eliminating any
need to translate it. Without any translation, the lower corner will
exactly touch your plane at 0,y and the y rotation will be around it
without any chance of it moving.
Sometimes, as in this particuliar case, creating the object around the
origin is not the best way. Creating it with a specific point at the
origin is the best way.
Then, you rotate it as Tim explaned.
For any object destined to rest on another, like on a floor, if's often
beter to create it with it's base at 0*y. It's beter to create a door
with one of it's edge at 0*x and 0*z and it's base slightly raised:
0.1*y for example.
Alain
Post a reply to this message
|
![](/i/fill.gif) |